<?php
/**
 * @authors alex (20779512@qq.com)
 * @date    2014-03-24 17:25:39
 * @version 1.0
 */

class IncomeAction extends HomeAction {

    public function index(){
        $level = I('get.level',1);
        $map['toUserID'] = $this->_user['memberID'];
        if ($level!='') {
            $map['level'] = $level;
        }

        $obj = M('Yongjin');
        $count = $obj->where($map)->count();
        import("@.ORG.WapPage");
        $page = new Page($count, 10);
        $show = $page->show();
        $list = $obj->where($map)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
        foreach ($list as $key => $value) {
            $list[$key]['fromUser'] = M('Member')->where('wxid="'.$value['fromUserWx'].'"')->getField('wxname');
        }
        $empty = '<div class="empty"><img src="'.RES.'/image/nomoney.jpg"><p>您的收益是0，还要再加把劲呀！</p></div>';
        $this->assign('empty',$empty);  

        $this->assign('cateName', $cateName);
        $this->assign('list', $list);
        $this->assign('page', $show);
        $this->assign('level', $level);
        $this->display();
    } 

}